package com.gzx.plugin.tjzy.xxljob;

import com.gzx.plugin.tjzy.modular.call.ht.service.GzxHtCallRecordService;
import com.gzx.plugin.tjzy.modular.call.pre.service.GzxPreOutCallService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import vip.xiaonuo.common.annotation.CommonCheckInstanceOnline;
import vip.xiaonuo.common.util.CommonDateUtil;

/**
 * @author zjt
 * @description
 * @date 2025/2/25 17:56
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class SyncCallRecordXxlJob {

    private final GzxHtCallRecordService htCallRecordService;

    private final GzxPreOutCallService preOutCallService;

    /**
     * 同步恒天话单
     */
    @XxlJob("syncCallRecordCustomerTimeJobHandler")
    @CommonCheckInstanceOnline
    public void syncCallRecordCustomerTimeJobHandler() {
        log.info("同步恒天话单--------------->XxlJob定时任务启动：{}", CommonDateUtil.getCurrentTimeStr());
        htCallRecordService.syncCallRecordCustomerTime();
    }

    /**
     * 同步恒天话单
     */
    @XxlJob("syncCallRecordLastJobHandler")
    @CommonCheckInstanceOnline
    public void syncCallRecordLastJobHandler() {
        log.info("同步恒天话单--------------->XxlJob定时任务启动：{}", CommonDateUtil.getCurrentTimeStr());
        htCallRecordService.syncCallRecordLast();
    }

    /**
     * 补偿预测外呼数据
     */
    @XxlJob("offsetPreOutDetailJobHandler")
    @CommonCheckInstanceOnline
    public void offsetPreOutDetailJobHandler() {
        log.info("补偿预测外呼数据--------------->XxlJob定时任务启动：{}", CommonDateUtil.getCurrentTimeStr());
        preOutCallService.offsetPreOutDetailJobHandler();
    }
}
